home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / Demos / Herois / Codigo.Cst / 00074_Script_IndicadorScroll < prev    next >
Text File  |  1999-03-19  |  2KB  |  59 lines

  1. property sprLista  -- Sprite que contem lista a ser scrollada
  2.  
  3. property sprMe
  4. property intMinY, intDY -- Posicao possivel para o indicador assumir
  5.  
  6. on getBehaviorDescription
  7.   return "Trata do indicador de altura de scroll"
  8. end
  9.  
  10. on getPropertyDescriptionList
  11.   set p_list = [ ¼
  12.     #sprLista: [ #comment:   "Sprite que contem lista a ser scrollada", ¼
  13.                     #format:   #integer, ¼
  14.                    #default:    "" ] ¼
  15.   ]
  16.   return p_list
  17. end
  18.  
  19. -- Primeiro captura dimensoes na tela do sprite da lista no qual
  20. -- ira scrollar
  21. on beginSprite me
  22.   put the spriteNum of me into sprMe
  23.   put 14 into intMinY
  24.   move me, 0
  25. end
  26.  
  27. -- Coloca list em uma certa posicao (1 - 10000)
  28. on move me, posicao
  29.   put the locV of sprite sprLista into y
  30.   put (the height of sprite sprLista) ¼
  31.       - 15 - (the height of sprite sprMe) into intDY
  32.   put y + intMinY + intDY * posicao / 10000 into y
  33.   set the locV of sprite sprMe to y
  34. end
  35.  
  36. -- Arraste
  37. on mouseDown me
  38.   put (the height of sprite sprLista) ¼
  39.       - 15 - (the height of sprite sprMe) into intDY
  40.   put the mouseV into mY
  41.   put the locV of sprite sprLista into y
  42.   put y + intMinY into minY
  43.   put minY + intDY into maxY
  44.   put the locV of sprite sprMe into iniY
  45.   put iniY - mY into dmY
  46.   put iniY into mY
  47.   repeat while the mouseDown
  48.     put the mouseV + dmY into tmp
  49.     if tmp < minY then put minY into tmp
  50.     else if tmp > maxY then put maxY into tmp
  51.     if tmp <> mY then
  52.       put tmp into mY
  53.       set the locV of sprite sprMe to mY
  54.       sendSprite(sprLista, #scrollArraste, (mY - minY) * 10000 / intDY)
  55.       updateStage
  56.     end if
  57.   end repeat
  58.   sendSprite(sprLista, #scrollArrasteFim)
  59. end